<template>
  <h1>表单组件</h1>
  <el-form style="width: 500px;margin: 0 auto;" label-width="80">
    <el-form-item label="用户名">
      <el-input v-model="p.name" placeholder="请输入用户名"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input show-password v-model="p.pwd" placeholder="请输入密码"></el-input>
    </el-form-item>
    <el-form-item label="性别">
      <el-radio-group v-model="p.gender">
        <el-radio-button label="男" value="1"></el-radio-button>
        <el-radio-button label="女" value="0"></el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="所在地">
      <el-select v-model="p.city" placeholder="请选择城市">
        <el-option label="云南" value="yun"></el-option>
        <el-option label="贵州" value="gui"></el-option>
        <el-option label="四川" value="chuan"></el-option>
        <el-option label="重庆" value="yu"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="管理员">
      <el-switch v-model="p.isAdmin"></el-switch>
    </el-form-item>
    <el-form-item>
      <el-button type="success" @click="show">点我提交</el-button>
    </el-form-item>
  </el-form>
  <h4 v-if="isShow">选择结果是：{{p}}</h4>
</template>

<script setup>
import {ref} from "vue";

const p = ref({
  name:'',pwd:'',gender:'',city:'',isAdmin:true
});
const isShow = ref(false);
const show = ()=>{
  isShow.value = true;
}
</script>


<style scoped>

</style>